namespace Plugins.Library
{
    using System;
    using System.Diagnostics.CodeAnalysis;

    public class PluginActionDelegateWorkItem<T> : PluginSequentialWorkItemContainer<T>
    {
        private Action<T> _process;

        public PluginActionDelegateWorkItem(T item, Action<T> process)
            : base(item)
        {
            this._process = process;
        }

        protected override void Process()
        {
            this._process(Item);
        }

        [SuppressMessage("Microsoft.Design", "CA1000")]
        public static void QueryAsync(T item, Action<T> process)
        {
            PluginSequentialWorkItemContainer<T>.QueryAsync(new PluginActionDelegateWorkItem<T>(item, process));
        }

        [SuppressMessage("Microsoft.Design", "CA1000")]
        public static void QuerySync(T item, Action<T> process)
        {
            PluginSequentialWorkItemContainer<T>.QuerySync(new PluginActionDelegateWorkItem<T>(item, process));
        }
    }
}

